package com.h3c.nem.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.h3c.nem.dto.TbApprovalRecordDTO;
import com.h3c.nem.dto.TbFlowInstDTO;
import com.h3c.nem.dto.TbWorkerDTO;
import com.h3c.nem.dto.form.Attachment;
import com.h3c.nem.dto.form.ConfigTheFormSubmit;
import com.h3c.nem.dto.form.GetFormBusinessData;
import com.h3c.nem.dto.form.HistoryInfo;
import com.h3c.nem.entity.TbFlowInst;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Copyright (C), 2020-2020, h3c
 * FileName: ITbFlowInstService
 *
 * @Author: l22886
 * @Date: 2022-01-19
 * Description: tb_flow_inst service
 * Version: 1.0
 */
public interface ITbFlowInstService extends IService<TbFlowInst> {

    /**
     * @title: selectFuzzyByDto
     * @description: 模糊查询操作
     * @params: [ dto ]
     * @return: java.util.List
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public List<TbFlowInstDTO> selectFuzzyByDto(TbFlowInstDTO dto);
    public PageInfo<TbFlowInstDTO> selectFuzzyByDtoPage(TbFlowInstDTO dto, Integer currentPage, Integer pageSize);

    /**
     * @title: selectByDto
     * @description: 精确查询操作
     * @params: [ dto ]
     * @return: java.util.List
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public List<TbFlowInstDTO> selectByDto(TbFlowInstDTO dto);

    /**
     * @title: insertDto
     * @description: 插入操作
     * @params: [ dto ]
     * @return: Integer
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public Integer insertDto(TbFlowInstDTO dto);

    Boolean insertBatch(List<TbFlowInst> dto);

    /**
     * 通过员工查询对应审批流程
     * @param dto
     * @return
     */
    Map<String, Object> queryTaskByDto(TbFlowInstDTO dto);

    /**
     * 通过busiId获取file
     * @param busiType
     * @param busiId
     * @return
     */
    List<Attachment> getFileListByBusiId(Integer busiType, String busiId);

    public List<HistoryInfo> getHistoryInfosForPre(String docId);
    /**
     * 流转记录数据
     * @param flowId
     * @return
     */
    List<HistoryInfo> getHistoryInfos(String flowId);

    /**
     * 获取数据结构
     * @param formBusinessData
     * @return
     */
    Map<String, Object> getTaskInfoData(GetFormBusinessData formBusinessData);

    /**
     * 小任务提交接口
     * @param dto
     * @return
     */
    Integer submitTask(String flowId, String taskFinishNote, String fileList);

    /**
     * 生成待办
     * @param tbFlowInst
     */
    void initTodoTask(TbFlowInst tbFlowInst);

    /**
     * @title: updateDto
     * @description: 修改操作
     * @params: [ dto ]
     * @return: Integer
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public Integer updateDto(TbFlowInstDTO dto);

    /**
     * @title: deleteDto
     * @description: 删除操作
     * @params: [ dto ]
     * @return: Integer
     * @createTime: 2022-01-19
     * @version: 1.0
     * @author: l22886
     */
    public Integer deleteDto(TbFlowInstDTO dto);

    public void transferSpecificFlowInst(List<TbFlowInstDTO> flowInstDTOS);

    public void controlSpecificFlowInst(List<TbFlowInstDTO> flowInstDTOS);

    public void endSpecificFlowInst(List<TbFlowInstDTO> flowInstDTOS);

    public void mailReminder(List<TbFlowInstDTO> flowInstDTOS);

    public Boolean createSpecificFlowInst(TbWorkerDTO workerDTO, Set<String> flowWorkerIdCodeSet);

    ArrayList<TbFlowInstDTO> createAllExpireSpecificFlowInst(TbWorkerDTO workerDTO,Set<String> flowWorkerIdCodeSet);
    TbFlowInstDTO setSpecificFlowInst(TbWorkerDTO workerDTO);

    Integer approvalTask(TbApprovalRecordDTO dto);

    void taskFormSubmit(ConfigTheFormSubmit configTheFormSubmit);
}
